package com.fushenlan.epidemicControl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fushenlan.Vo.InhabitInfoVo;
import com.fushenlan.epidemicControl.dto.*;
import com.fushenlan.epidemicControl.dto.request.NucleinDetectionResultDetailsReqDTO;
import com.fushenlan.po.NucleinDetectionApplyRecord;
import com.fushenlan.po.NucleinDetectionApplyRecordRelation;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhulei
 * @title: NucleinDetectionApplyRecordMapper
 * @projectName 核酸检测申请记录
 * @description:
 * @date 2022/4/25
 */
@Repository
public interface NucleinDetectionApplyRecordMapper extends BaseMapper<NucleinDetectionApplyRecord> {

    List<NucleinDetectionApplyRecordRespDTO> queryNucleinDetectionApplyRecord(String startDate, String endDate, Long neighborhoodId);

    //密接人员信息查询
    List<DetectionPersonalInfoRespDTO> querycloseContactInfo(Long id, Long detectionId);

    //全部小区 根据当前居委id 查询所有小区ids
    List<String> queryAllResidentialIds(Long neighborId);

    //全部小区 根据当前居委id 查询所有小区ids 对应 userIds
    List<String> queryAllUserIds(@Param("neighborId") Long neighborId, @Param("ids") List<String> ids);

    //获取小区信息
    List<CommunityinfoRespDTO> queryCommunityList(@Param("relationsList") List<NucleinDetectionApplyRecordRelation> relationsList);
    //获取居民信息list
    List<InhabitInfoVo> findInhabitList(@Param("relationsList") List<NucleinDetectionApplyRecordRelation> relationsList);

    //获取未检测人数 未登记人数 阳性人数
    int getTargetNum( Long id, String ifDetection, String ifRegister, String detectionResult,Long neighborhoodId);
    //获取未转运人数
    int getNoTransportNum( Long id, String userStatus,Long neighborhoodId);

    //检测结果查询
    IPage<NucleinDetectionResultRespDTO> queryNucleinDetectionResult(IPage<T> p,
                                                                     String startDate,
                                                                     String endDate,
                                                                     Long neighborhoodId);

    // 根据检测结果、转运情况、是否已检测状态信息汇总人员查找
    IPage<DetectionPersonalInfoRespDTO> queryNucleinDetectionResultDetails(  IPage<T> p,
                                                                             Long neighborhoodId,
                                                                             Long community,
                                                                             String name,
                                                                             Integer detectionResult,
                                                                             Integer userStatus,
                                                                             Integer ifDetection,
                                                                             Long detectionId);

    // 根据检测结果、转运情况、是否已检测状态信息汇总人员查找
    List<DetectionPersonalStatusInfoDo> queryNucleinDetectionResultStatusDetails(Long detectionId,
                                                                                 Integer userStatus );
}